grammar RecordFormat;

format : 'record' parameters '{' members '}' ;

parameters : '(' (parameter (',' parameter)*)? ')' ;

parameter : '@' key '=' value ;

key : VARIABLENAME ;

value : BOOLEAN | INT | STRING ;

members : member (',' member)* ;

member : fieldName parameters (| '{' members* '}') ;

fieldName : VARIABLENAME ;

BOOLEAN : TRUE | FALSE ;

// parser rules start with lowercase letters, lexer rules with uppercase
INT :   [0-9]+ ;             // Define token INT as one or more digits
VARIABLENAME : [a-zA-Z][a-zA-Z0-9\.]+ ;
TRUE : 'true' ;
FALSE : 'false' ;
STRING: '"'( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '.' | '_' | '-' | '/' | ',' | ' ' | '\'' | '(' | ')' | ',' | ':' | ';' | '\t' | '&' | ']' | '[' )*'"';
WS  :   [ \t\r\n]+ -> skip ; // Define whitespace rule, toss it out
